<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"> 

	<h:form id="formTrainingSystemData" prependId="false" style="height:100%" >
		<h:panelGrid columns="2" cellpadding="2" columnClasses="top-align,top-align" style="min-height:90%;width:100%"  > 
			<h:column>
				<h:panelGrid columns="2" cellpadding="2" > 
		            <h:outputLabel value="#{msgs.Name} :" for="trainingSystemName" />
		            <p:inputText id="trainingSystemName"     value="#{trainingSystemBean.trainingSystem.name}" maxlength ="20" size="20" required="true" requiredMessage="#{msgs.TrainingSystemNameObligatory}" />
		
	
					<h:outputLabel value="#{msgs.Description} :" for="trainingSystemDescription" />
					<p:inputTextarea id="trainingSystemDescription" rows="4" cols="50"
						counter="counter" maxlength="180"
						counterTemplate="{0} #{msgs.CharsRemaining}" autoResize="false"
						value="#{ trainingSystemBean.trainingSystem.description}" />
					<p:spacer />
					<h:outputText id="counter" />

					<h:outputLabel value="#{msgs.Obs} :" for="trainingSystemObs" />
					<p:inputTextarea id="trainingSystemObs" rows="4" cols="50"
						counter="counter2" maxlength="180"
						counterTemplate="{0} #{msgs.CharsRemaining}" autoResize="false"
						value="#{ trainingSystemBean.trainingSystem.obs}" />
					<p:spacer />
					<h:outputText id="counter2" />

					<h:outputLabel 	value="#{msgs.Library} :"		for="trainingSystemLibrary" rendered="#{trainingSystemBean.trainingSystem.id == null}" />
					<p:selectOneMenu id="trainingSystemLibrary" value="#{trainingSystemBean.trainingSystem.library}"	  rendered="#{trainingSystemBean.trainingSystem.id == null}" converter="#{libraryConverter}">
		            	<f:selectItems value="#{trainingSystemBean.activeUser.librarys}" var="library" itemLabel="#{library.name}" itemValue="#{library}"  />
					</p:selectOneMenu>

					<h:outputLabel 	value="#{msgs.Library} :"		for="trainingSystemSavedLibrary" rendered="#{trainingSystemBean.trainingSystem.id != null}"  />
					<p:inputText id="trainingSystemSavedLibrary" value="#{trainingSystemBean.trainingSystem.library.name}"  disabled="true" rendered="#{trainingSystemBean.trainingSystem.id != null}" />
										
					<h:outputLabel 	value="#{msgs.CreatedAt} :"		for="trainingSystemCreatedAt" rendered="#{trainingSystemBean.trainingSystem.id != null}" />
					<p:inputText  	id="trainingSystemCreatedAt" 	value="#{trainingSystemBean.trainingSystem.createdAt}" disabled="true" rendered="#{trainingSystemBean.trainingSystem.id != null}"  >
						<f:convertDateTime locale="pt" dateStyle="long" pattern="dd/MM/yyyy HH:mm" rendered="#{trainingSystemBean.trainingSystem.id != null}" />
					</p:inputText>
		
					<h:outputLabel 	value="#{msgs.ChangedAt} :"		for="trainingSystemChangedAt" rendered="#{trainingSystemBean.trainingSystem.id != null}" />
					<p:inputText  	id="trainingSystemChangedAt" 	value="#{trainingSystemBean.trainingSystem.lastChange}" disabled="true"  rendered="#{trainingSystemBean.trainingSystem.id != null}">
						<f:convertDateTime locale="pt" dateStyle="long" pattern="dd/MM/yyyy HH:mm" />  
					</p:inputText>
				</h:panelGrid>			
			</h:column>
		</h:panelGrid>		
		<div align="left"   >
			<p:commandButton  value="#{msgs.Save}"		action="#{trainingSystemBean.saveTrainingSystem}"		
				ajax="true"	update=":growl,:content, :listTrainingSystemForm"		icon="ui-icon-disk"	rendered="#{trainingSystemBean.trainingSystem.id != null}" />
			<p:commandButton  value="#{msgs.Create}"	action="#{trainingSystemBean.createTrainingSystem}"	
				ajax="true"	update=":growl,:content, :listTrainingSystemForm"		icon="ui-icon-document"	rendered="#{trainingSystemBean.trainingSystem.id == null}" />
			<p:spacer width="50px"/>	
			<p:commandButton  value="#{msgs.Cancel}" update=":growl,:content"	action="#{trainingSystemBean.cancelChange}"	icon="ui-icon-cancel"/>
		</div>
	</h:form>
</html>